<script type="text/javascript">
	function doSearchCommentInfo(value) {
		
	}
	
	//表格查询  
	function reloadCommentInfo() {
		var params = commentInfo_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		commentInfo_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		commentInfo_list.datagrid('unselectAll');
		commentInfo_list.datagrid('uncheckAll');
	}


	function addCommentInfo() {
		createFromWindow("新增信息", "commentInfo.do?editCommentInfo", "commentInfo.do?saveCommentInfo",
				function(data) {
					reloadCommentInfo();
				});
	}
	
	function deleteCommentInfo() {
		var rows = commentInfo_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('commentInfo.do?deleteCommentInfoItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadCommentInfo();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editCommentInfo() {
		var rows = commentInfo_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "commentInfo.do?editCommentInfo&commentInfoId=" + rows[0].id,
					"commentInfo.do?saveCommentInfo", function(data) {
						reloadCommentInfo();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	//操作按钮触发
	function operationsLookCommentInfo(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = commentInfo_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			createFromWindow("查看信息", "commentInfo.do?editCommentInfo&commentInfoId=" + id,
					null, null,false);
		} else {
			showMsg('请选择查看记录.');
		}
	}
	
	function operationsEditCommentInfo(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = commentInfo_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			createFromWindow("编辑信息", "commentInfo.do?editCommentInfo&commentInfoId=" + id,
					"commentInfo.do?saveCommentInfo", function(data) {
						reloadCommentInfo();
					},true);
		} else {
			showMsg('请选择编辑记录.');
		}
	}
	
	function operationsSendCommentInfo() {
		printLog('发送');
	}
	
	function operationsDeleteCommentInfo(id) {
		if (id == undefined) {//点击右键菜单才会触发这个
			var rows = new_list.datagrid('getSelections');
			id = rows[0].id;
		}
		if (id) {
			$.messager.confirm('询问', '你确认要删除吗?', function(r) {
				if (r) {
					$.post('commentInfo.do?deleteCommentInfoItems', {
						ids : id
					}, function(result) {
						if (result.success) {
							reloadCommentInfo(); 
						}
						showMsg(result.msg);
					}, 'json');
				}
			});
		} else {
			showMsg("请选择操作记录.");
		}
	}
</script>

<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		
		<@eu.datagrid id="commentInfo_list" toolbar="#commentInfolist_search" idField="id" 
			 url="commentInfo.do?loadList" rownumbers="true"
			 item="com.xdtech.forum.vo.CommentInfoItem"/>
		
		<div id="commentInfolist_search">
			<div id="commentInfo_toolbar" style="height: auto">
				
				<@eu.linkbutton showName="新增" shiro="forum:commentInfo:add" iconCls="icon-add" onclick="addCommentInfo()"/>
				<@eu.linkbutton showName="删除" shiro="forum:commentInfo:delete" iconCls="icon-remove" onclick="deleteCommentInfo()"/>
				<@eu.linkbutton showName="编辑" shiro="forum:commentInfo:edit" iconCls="icon-edit" onclick="editCommentInfo()"/>
				<@eu.linkbutton showName="刷新" shiro="forum:commentInfo:refresh" iconCls="icon-reload" onclick="reloadCommentInfo()"/>
				
			</div>
		</div>
	</div>
</div>